import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
import { ComboGroup } from './comboGroup';

@Define.Table({ TableName: 'combo' })
export class Combo extends EntityObjectType<Combo> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    productId: string;

    @Define.Column({
        DataType: Define.DataType.Decimal,
        DataLength: 10,
        DecimalPoint: 3,
        NotAllowNULL: true,
        DefaultValue: 0,
    })
    totalPrice: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    storeId: string;

    @Define.Mapping({
        Mapping: 'ComboGroup',
        MappingKey: 'comboId'
    })
    comboGroups: ComboGroup[];

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;
}